#include<bits/stdc++.h>
using namespace std;
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	int a[8080];
	int b[8080]; 
	bool p[8080];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(p,false,sizeof(p));
	int n,q,op,x,v; 
	cin>>n>>q; 
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	while(q--)
	{
		cin>>op;
		if(op==1)
		{
			cin>>x>>v;
			a[x]=v;	
		} 
		if(op==2)
		{
			cin>>x;
			p[x]=true; 
			for(int i=1;i<=n;i++)
			{ 
				b[i]=a[i];
			}
			for (int i = 1; i <= n; i++)
			{
				for (int j = i; j>=2; j--)
				{
					if ( b[j] < b[j-1] )
					{
						int t = b[j-1];
						b[j-1] = b[j];
						b[j] = t;
						bool k = p[j-1];
						p[j-1] = p[j];
						p[j] = k;
					}
				}
			}
			for(int i=1;i<=n;i++)
			{
				if(p[i])
				{
					cout<<i<<endl;
					p[i]=false;
					break;	
				}		
			}
		}
	}
	fclose(stdin);
	fclose(stdout);
}
